package com.wuhainan.beelzebub.controller.system;

import com.wuhainan.beelzebub.entity.system.User;
import com.wuhainan.beelzebub.service.system.UserService;
import com.wuhainan.beelzebub.utils.PageInfo;
import com.wuhainan.beelzebub.utils.TableData;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <br>Created by 吴海南 on 2017-12-18.
 * <br>星期一 at 上午 10:11.
 */
@RestController
@RequestMapping("api")
public class UserController {
    @Resource
    private UserService userService;
    @RequestMapping("userPage")
    public TableData userPage(PageInfo pageInfo, User user){
        return userService.findUserPage(pageInfo,user);
    }
    @RequestMapping("user/{id}")
    public User user(@PathVariable String id) {
        return userService.findUserById(id);
    }

    @RequestMapping("saveuser")
    public void saveuser(@RequestBody User user) {
        userService.saveUser(user);
    }

    @RequestMapping("deleteuser")
    public void deleteuser(@RequestBody User user) {
        userService.deleteUser(user);
    }
    @RequestMapping("restoreuser")
    public void restoreuser(@RequestBody User user) {
        userService.restoreUser(user);
    }
}
